package exam.utils;

import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.exceptions.JWTCreationException;
import com.auth0.jwt.interfaces.DecodedJWT;
import exam.bean.UserInfo;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;


public class TokenUtil {
    /**
     * 过期时间为一周
     */
    private static final long Expire=60000*60*24*7;
    /**
     * 密钥
     */
    private static final String secret="xdclass.net168";
    /**
     * 令牌前缀
     */
    private static final String Token_PreFix="xdclass";
    /**
     * subject主题
     */
    private static final String SUBJECT="xdclass";

    private String jwtToken(UserInfo userInfo) {
//        return JWT.create()
//                .withClaim("userId", userInfo.getId())
//                .withClaim("username", userInfo.getName())
//                .withClaim("role", userInfo.getUserGroupId())
//                .withClaim("expireAt", expireTime())
//                .sign(Algorithm.HMAC256(jwtSecret));
        return "sss";
    }
}
